﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<SG.Domain.ArticuloProveedor>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Artículos por Proveedor
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="TitlePage" runat="server">
Artículos por Proveedor
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Head" runat="server">
    
    <link href="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css") %>" rel="stylesheet" type="text/css" />   
    <link href="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid_skins.css") %>" rel="stylesheet" type="text/css" />
    <link href="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_blue.css") %>" rel="stylesheet" type="text/css" />


    <script src="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js") %>" type="text/javascript"></script>
     <script src="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js") %>" type="text/javascript"></script>
    <script src="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js") %>" type="text/javascript"></script>
    <script src="<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js") %>" type="text/javascript"></script>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <%
      
       string array = "";
       foreach (var item in Model)
       {
           array += ",['"+
                        item.Id + "','" +   
                        item.Proveedor.Nombre + "','" +                                        
                        item.Articulo.Nombre + "','" +
                        item.Articulo.NumeroArticulo + "','" +        
                        item.CantidadMinDescuento + "','" +
                        item.CostoAdquisicion + "','" +
                        item.CostoEmision + "','" +
                        item.Descuento + "','" +
                        item.TiempoEspera + "','" +
                    "']";
                       
       }
       if (string.IsNullOrEmpty(array))
           array = "Array()";
       else 
           array =  "["+array.Substring(1)+"]";
       
        %>
         
            <div id="gridList" style="height:100%"></div>
    
    
    <script type="text/javascript">
      var jarray = <%=(array??"new array()") %>;

        var mygrid;
      
          var winx; 
          window.onload=doOnLoad;
        function doOnLoad(){
           
            mygrid = new dhtmlXGridObject('gridList');
            mygrid.setImagePath("<%=Url.Content("~/Scripts/dhtmlx/dhtmlxGrid/codebase/imgs/") %>");
            mygrid.setHeader(",Proveedor, Artículo,Nro Artículo, Cantidad mínima descuento,Costo adquisición,Costo emisión, Descuento,Tiempo de espera",null,["text-align:center","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;"]);
            mygrid.attachHeader(",#select_filter,#text_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter");
            mygrid.setInitWidths("0,200,200,120,120,120,120,120,120");
            mygrid.setColAlign("left,left,left,left,left,left,left,left,left");
            mygrid.setColTypes("ed,ed,ed,ed,ed,ed,ed,ed,ed");
            mygrid.setColumnIds("ID,NOMBREPROVEEDOR,NROARTICULO,ARTICULO,CANTIDADMINDESCUENTO,COSTOADQUISICION,COSTOEMISION,DESCUENTO,TIEMPOESPERA");
            mygrid.enableEditEvents(false,false,false);
            mygrid.setSkin("light");
            mygrid.setColSorting("int,str,str,int,int,int,int,int,int");
            
            mygrid.enableAutoHeight(true);
           

            
            mygrid.init();
            mygrid.parse(jarray, "jsarray");


          
           
        }
        
    </script>
</asp:Content>

